home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / What's New? / Software Development Kits / Mac OS USB DDK / MacOS USB DDK 1.0b4 / NeptuneDDK / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-26  |  2.7 KB  |  89 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. Boolean    immediateError(OSStatus err);
  22. void    MouseModuleInitiateTransaction(USBPB *pb);
  23. void    MouseModuleDelayCompletionProc(USBPB *pb);
  24. void     TransactionCompletionProc(USBPB *pb);
  25. void    DriverEntry(USBDeviceRef device, USBDeviceDescriptorPtr pDeviceDescriptor);
  26. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  27.  
  28. /*    Prototypes from MouseModuleHeader.c    Tue, Mar 17, 1998 3:30:22 PM    */
  29. static     OSStatus    MouseModuleInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  30. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  31. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  32.  
  33.  
  34. /*    Prototypes from MouseConfigParse.c    Tue, Mar 17, 1998 3:17:14 PM    */
  35. OSErr FindHIDInterfaceByProtocol(LogicalAddress pConfigDesc, UInt32 ReqProtocol, USBInterfaceDescriptorPtr * hInterfaceDesc);
  36.  
  37. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  38. void     NotifyRegisteredHIDUser(UInt32 devicetype, UInt8 hidReport[]);
  39.  
  40. void     USBMouseIn(UInt8 theDeviceClass, void * theData);
  41. void     InitParamBlock(USBDeviceRef theDeviceRef, USBPB * paramblock);
  42.  
  43. #define kMouseRetryCount    10
  44.  
  45. enum driverstages
  46. {
  47.     kUndefined = 0,
  48.     kGetFullConfiguration,
  49.     kFindInterfaceAndSetProtocol,
  50.     kSetIdleRequest,
  51.     kFindAndOpenInterruptPipe,
  52.     kReadInterruptPipe,
  53.     kReturnFromDriver =     0x1000,
  54.     kRetryTransaction =     0x2000,
  55.     kSyncTransaction =         0x4000,
  56.     kCompletionPending =     0x8000
  57. };
  58.  
  59. typedef struct
  60. {
  61.     USBPB                             pb;
  62.     void (*handler)(USBPB             *pb);
  63.  
  64.     USBDeviceRef                    deviceRef;
  65.     USBInterfaceRef                    interfaceRef;
  66.     USBPipeRef                        pipeRef;
  67.     
  68.     USBDeviceDescriptor             deviceDescriptor;
  69.     USBInterfaceDescriptor            interfaceDescriptor;
  70.  
  71.     USBConfigurationDescriptorPtr     pFullConfigDescriptor;
  72.     USBInterfaceDescriptorPtr        pInterfaceDescriptor;
  73.     USBEndPointDescriptorPtr        pEndpointDescriptor;
  74.  
  75.     UInt32                            hidDeviceType;
  76.     UInt8                            hidReport[64];
  77.     
  78.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  79.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  80.     
  81.     SInt32                             retryCount;
  82.     SInt32                            transDepth;
  83.     
  84.     CursorDevicePtr                    pCursorDeviceInfo;
  85.     CursorDevice                    cursorDeviceInfo;
  86.     Fixed                            unitsPerInch;
  87. } usbMousePBStruct;
  88.  
  89. #endif //__MouseModuleH__